<?php
# http://projects:8081/cdapp-2kt-api/api/common_params.php

include_once '_portal.php';

$method = $post->method;
$keys = $post->keys;
$values = isset($post->values) ? $post->values : null;

if ($method == 'SET' || $method == 'SAVE' || $method == 'UPDATE') {
  if (is_null($values)) {
    output(null);
    die();
  }
  $result = [];
  for ($i = 0; $i < count($keys); $i++) {
    $result[] = save_param($keys[$i], $values[$i]);
  }
  output($result);
} elseif ($method == 'GET' || $method == 'LOAD' || $method == 'SELECT') {
  $result = [];
  for ($i = 0; $i < count($keys); $i++) {
    $result[$keys[$i]] = get_param($keys[$i]);
  }
  output($result);
}
die();